Full source code website bán hàng thương mại điện tử gần giống shopee
468.978 lượt xem;
1 <?
2 if (isset($_POST['butSaveLoai'])) {
3 $products_id=$_POST['txtProductid'];
4 $sort = $_POST['txtSortOrder'];
5 $status=($_POST['chkShow']!=''?1:0);
6
7 $ten = trim($_POST['txtName']);
8 if ($products_id=="")
9 {
10 echo "<p align=center class='err'>Bạn chưa chọn mã sản phẩm</p>";
11 }
12 else
13 {
14 if (!empty($_POST['oldid'])) {
15 $oldid = $_POST['oldid'];
16 $sql = "update pro_new set products_id='".$products_id."', pro_sortorder='".$sort."', pro_status=".$status." where pro_id='".$oldid."'";
17 }
18 else
19 $sql = "insert into pro_new (products_id,pro_sortorder, pro_status) values ('".$products_id."','".$sort."',".$status.")";
20 if (mysql_query($sql,$con)) {
21 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
22 echo "<script>window.location='index.php?act=pro_new&page=".$_REQUEST['page']."'</script>";
23 }
24 else echo "<p align=center class='err'>Không thể cập nhật</p>";
25 }
26 }
27 ?>
28
29 <?
30 if (isset($_GET['id'])) {
31 $oldid=$_GET['id'];
32 $sql = "select * from pro_new where pro_id='".$oldid."'";
33 if ($result = mysql_query($sql,$con)) {
34 $row=mysql_fetch_array($result);
35 $products_id=$row['products_id'];
36 $order=$row['pro_sortorder'];
37 $status=$row['pro_status'];
38 $date=$row['date_add'];
39 }
40 }
41 ?>
42
43 <form method="POST" name="FormLoaiSP" action="index.php">
44 <input type=hidden name="act" value="pro_new_m">
45 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
46 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
47 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
48 <tr>
49 <td width="45%" align="center" class="title" height="20">Sửa đổi / Cập nhật
50 : Sản phẩm mới</td>
51 </tr>
52 <tr>
53 <td width="45%">
54 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
55 <tr>
56 <td width="15%" class="smallfont">
57 <p align="right">Mã sản phẩm</td>
58 <td width="1%" class="smallfont">
59 <font color="#FF0000">*</font></td>
60 <td width="83%" class="smallfont">
61 <INPUT readonly value="<? echo $products_id; ?>" TYPE="text" NAME="txtProductid" CLASS=textbox size="34"></td>
62 </tr>
63 <tr>
64 <td width="15%" class="smallfont" align="right">
65 Không hiển thị</td>
66 <td width="1%" class="smallfont" align="right">
67 </td>
68 <td width="83%" class="smallfont">
69 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
70 </tr>
71 <tr>
72 <td width="15%" class="smallfont" align="right">
73 Thứ tự sắp xếp</td>
74 <td width="1%" class="smallfont" align="right">
75 </td>
76 <td width="83%" class="smallfont">
77 <INPUT value="<? echo $order; ?>" TYPE="text" NAME="txtSortOrder" CLASS=textbox size="34"></td>
78 </tr>
79 <tr>
80 <td width="15%" class="smallfont">
81 <p align="right">
82 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
83 <td width="1%" class="smallfont">
84 </td>
85 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
86 </tr>
87 </table>
88 </td>
89 </tr>
90 </table>
91 </form>
2 if (isset($_POST['butSaveLoai'])) {
3 $products_id=$_POST['txtProductid'];
4 $sort = $_POST['txtSortOrder'];
5 $status=($_POST['chkShow']!=''?1:0);
6
7 $ten = trim($_POST['txtName']);
8 if ($products_id=="")
9 {
10 echo "<p align=center class='err'>Bạn chưa chọn mã sản phẩm</p>";
11 }
12 else
13 {
14 if (!empty($_POST['oldid'])) {
15 $oldid = $_POST['oldid'];
16 $sql = "update pro_new set products_id='".$products_id."', pro_sortorder='".$sort."', pro_status=".$status." where pro_id='".$oldid."'";
17 }
18 else
19 $sql = "insert into pro_new (products_id,pro_sortorder, pro_status) values ('".$products_id."','".$sort."',".$status.")";
20 if (mysql_query($sql,$con)) {
21 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
22 echo "<script>window.location='index.php?act=pro_new&page=".$_REQUEST['page']."'</script>";
23 }
24 else echo "<p align=center class='err'>Không thể cập nhật</p>";
25 }
26 }
27 ?>
28
29 <?
30 if (isset($_GET['id'])) {
31 $oldid=$_GET['id'];
32 $sql = "select * from pro_new where pro_id='".$oldid."'";
33 if ($result = mysql_query($sql,$con)) {
34 $row=mysql_fetch_array($result);
35 $products_id=$row['products_id'];
36 $order=$row['pro_sortorder'];
37 $status=$row['pro_status'];
38 $date=$row['date_add'];
39 }
40 }
41 ?>
42
43 <form method="POST" name="FormLoaiSP" action="index.php">
44 <input type=hidden name="act" value="pro_new_m">
45 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
46 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
47 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
48 <tr>
49 <td width="45%" align="center" class="title" height="20">Sửa đổi / Cập nhật
50 : Sản phẩm mới</td>
51 </tr>
52 <tr>
53 <td width="45%">
54 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
55 <tr>
56 <td width="15%" class="smallfont">
57 <p align="right">Mã sản phẩm</td>
58 <td width="1%" class="smallfont">
59 <font color="#FF0000">*</font></td>
60 <td width="83%" class="smallfont">
61 <INPUT readonly value="<? echo $products_id; ?>" TYPE="text" NAME="txtProductid" CLASS=textbox size="34"></td>
62 </tr>
63 <tr>
64 <td width="15%" class="smallfont" align="right">
65 Không hiển thị</td>
66 <td width="1%" class="smallfont" align="right">
67 </td>
68 <td width="83%" class="smallfont">
69 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
70 </tr>
71 <tr>
72 <td width="15%" class="smallfont" align="right">
73 Thứ tự sắp xếp</td>
74 <td width="1%" class="smallfont" align="right">
75 </td>
76 <td width="83%" class="smallfont">
77 <INPUT value="<? echo $order; ?>" TYPE="text" NAME="txtSortOrder" CLASS=textbox size="34"></td>
78 </tr>
79 <tr>
80 <td width="15%" class="smallfont">
81 <p align="right">
82 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
83 <td width="1%" class="smallfont">
84 </td>
85 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
86 </tr>
87 </table>
88 </td>
89 </tr>
90 </table>
91 </form>